<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 
<head>
<title>Crlf Sample</title>
<link rel="stylesheet" type="text/css" href="../../../docs/rotor.css">
</head>

<body>		


<h1> Crlf Sample</h1>


<h2>Sample Overview</h2>


<p>This sample tool is a line termination analyzer. It reads a text 
file and analyzes all line termination in the file.&nbsp; It looks for 
linefeed-only characters or matched sets of carriage-return (CR) and linefeed 
(LF) characters.&nbsp; It also finds carriage-return-only characters but treats 
these as errors.</p>


<p>The sample will convert files from CRLF format to linefeed-only and from 
linefeed-only to CRLF.&nbsp; It will remove carriage-returns that aren't matched 
with linefeeds or convert them to the existing line termination, depending on 
user input.</p>


<p>The sample stores the locations to all line terminations in a specialized list 
type that allows walking the list from one line termination character to the 
next. So while the initial computation of the locations is relatively 
slow, subsequent modifications are relatively efficient.</p>


<p>The sample demonstrates binary file input and output.</p>

<h2>Sample Source and Build Output Locations</h2>


<p>The sample source is found in sscli20\samples\utilities\crlf.&nbsp; </p>


<p>The source file is:</p>


<ul class="none">
  <li><a href="crlf.cs">crlf.cs</a></li>
</ul>


<p>The build output location is %_NTTREE%\samples\utilities\crlf. The output file is an executable assembly named crlf.exe.</p>


<h2>Building the Sample</h2>


<p>All samples are built from the buildall script.&nbsp;  </p>


<p>You can also build all the 
samples by switching to the root of the sample directory, sscli20\samples, and typing 
<code>build -c</code>.</p>


<p>You can build this specific sample  by switching to the sample directory and typing 
<code>build -c</code>.</p>


<h2>Running the Sample</h2>


<p>These steps require that the Shared Source CLI (SSCLI) be already built and 
functional.</p>


<ol>
  <li>Run  env.bat. </li>
  <li>Switch to the %_NTTREE%\samples\utilities\crlf directory.</li>
  <li>Type the following command:<blockquote>


<p>clix crlf.exe <i>files</i></p>


  </blockquote>


  </li>
</ol>
<blockquote>


<p>where <i>files </i>is the name of the file in which you want line termination 
analysis or a wildcard expression that will match a set of files.</p>


</blockquote>


<hr>


<p><i>Copyright (c) 2006 Microsoft Corporation. All rights reserved.</i></p>
</body> 
</html>